package com.zr.serviceimpl;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.RemoveUsersDao;
import com.zr.service.RemoveUsersService;

@Service("removeUsersService")
public class RemoveUsersServiceImpl implements RemoveUsersService{

	@Resource
	private RemoveUsersDao removeUsersDao;
	
	@Override
	public void removeUsersByUid(int uid,String cuname, int cuid) {
		
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Date date = new Date();
			String time = sdf.format(date);
			StringBuffer infos = new StringBuffer();
			infos.append("编号为");
			infos.append(cuid);
			infos.append("的用户");
			infos.append(cuname);
			infos.append("在");
			infos.append(time);
			infos.append("注销了ID为");
			infos.append(uid);
			infos.append("的用户");
			String info = infos.toString();
			removeUsersDao.removeUsersByUid(uid);
			removeUsersDao.insertInfoIntoLog(time, cuname, cuid, info);
			
	}

	@Override
	public int getRemovedOrNot(int uid) {
		// TODO Auto-generated method stub
		return removeUsersDao.getRemovedOrNot(uid);
	}

	

	

}
